/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rafkind.raytracer;

/**
 *
 * @author drafkind
 */
public class IntersectionPoint implements Comparable<IntersectionPoint> {
  private Vector3 point;
  private double distanceFromRayOrigin;
  private VisibleObject target;

  public IntersectionPoint(Vector3 point, double distanceFromRayOrigin, VisibleObject target) {
    this.point = point;
    this.distanceFromRayOrigin = distanceFromRayOrigin;
    this.target = target;
  }

  public double getDistanceFromRayOrigin() {
    return distanceFromRayOrigin;
  }

  public Vector3 getPoint() {
    return point;
  }

  public VisibleObject getTarget() {
    return target;
  }

  public int compareTo(IntersectionPoint o) {
    if (this.distanceFromRayOrigin < o.distanceFromRayOrigin)
      return -1;
    else if (this.distanceFromRayOrigin > o.distanceFromRayOrigin)
      return 1;
    else
      return 0;
  }
}
